import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author LKQ
 * @date 2022/1/30 11:19
 * @description
 */
public class FormalSolution {
    public static void main(String[] args) {

    }
    public String[] uncommonFromSentences(String s1, String s2) {
        Map<String, Integer> map = new HashMap<>();
        insert(s1, map);
        insert(s2, map);
        List<String> list = new ArrayList<>();
        for (Map.Entry<String, Integer> a: map.entrySet()) {
            if (a.getValue() == 1) {
                list.add(a.getKey());
            }
        }
        return list.toArray(new String[0]);
    }
    public void insert(String s, Map<String, Integer> map) {
        String[] ans = s.split(" ");
        for (String a : ans) {
            map.put(a, map.getOrDefault(a, 0) + 1);
        }
    }
}
